package com.happy.study.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.happy.study.entity.AnswerEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @Author: Wuzh
 * @Description:
 * @Date Created in 17:09 2021/1/31
 * @return
 */
@Mapper
public interface AnswerMapper extends BaseMapper<AnswerEntity> {

    @Select (value = "SELECT ai.answerId, ai.subjectId, ai.recordId, ai.optionId, oi.optionContent, ai.userId, ai.createTime, ai.changeTime, ai.isUsed FROM answer_info ai left join option_info oi on oi.optionId=ai.optionId WHERE (ai.subjectId = #{answerEntity.subjectId} AND ai.userId = #{answerEntity.userId} AND ai.recordId = #{answerEntity.recordId})")
    AnswerEntity querySingle ( @Param ("answerEntity") AnswerEntity answerEntity );

}
